package com.qcby.model.dto;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Getter
@Setter
@NoArgsConstructor
@ToString
public class MovieDetailVo {

    private Integer mid;

    private Integer mtId;

    private String mtName;

    private Date releaseAt;

    private String mName;

    private String mDetail;

    private String fgName;

    private String mDuration;

    private String mPic;

    private BigDecimal avgMovieScore;


    private List<MovieActorVo> movieActorVoList = new ArrayList<>();

    public MovieDetailVo(MovieShowVo movieShowVo, List<MovieActorVo> movieActorVoList) {

        this.mid = movieShowVo.getMid();

        this.mtId = movieShowVo.getMtId();

        this.mtName = movieShowVo.getMtName();

        this.releaseAt = movieShowVo.getReleaseAt();

        this.mName = movieShowVo.getMName();

        this.mDetail = movieShowVo.getMDetail();

        this.fgName = movieShowVo.getFgName();

        this.mDuration = movieShowVo.getMDuration();

        this.mPic = movieShowVo.getMPic();

        if (movieShowVo.getAvgMovieScore() != null) {
            this.avgMovieScore = movieShowVo.getAvgMovieScore().setScale(2, RoundingMode.HALF_UP);
        }

        this.movieActorVoList.addAll(movieActorVoList);
    }
}
